package org.alesv.entranceExams.model;

import java.util.ArrayList;
import java.util.StringTokenizer;


/**
 * @author asantamaria
 */

public class WordsDictionary {

	/**
     * List of words
     */
    private ArrayList<String> wordsList;
    
    /**
     * TockenicedString of words
     */
    private String wordsTockenicedString;

	/**
	 * @return the wordsList
	 */
	public ArrayList<String> getWordsList() {
		return wordsList;
	}

	/**
	 * @param wordsList the wordsList to List
	 */
	public void setWordsList(ArrayList<String> wordsList) {
		this.wordsList = wordsList;
	}
	
    /**
	 * @return the wordsTockenicedString
	 */
	public String getWordsTockenicedString() {
		return wordsTockenicedString;
	}

	/**
	 * @param wordsTockenicedString the wordsTockenicedString to set
	 */
	public void setWordsTockenicedString(String wordsTockenicedString) {
		this.wordsTockenicedString = wordsTockenicedString;
		
		StringTokenizer stk = new StringTokenizer(wordsTockenicedString,",");
		while ( stk.hasMoreTokens() ) {  
			wordsList.add(stk.nextToken());  
			} 
	}

	/* (non-Javadoc)
	 * @see java.lang.Object#hashCode()
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((wordsList == null) ? 0 : wordsList.hashCode());
		return result;
	}

	/* (non-Javadoc)
	 * @see java.lang.Object#equals(java.lang.Object)
	 */
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		WordsDictionary other = (WordsDictionary) obj;
		if (wordsList == null) {
			if (other.wordsList != null)
				return false;
		} else if (!wordsList.equals(other.wordsList))
			return false;
		return true;
	}
}
